// 腾讯云视频上传
import COS from 'cos-js-sdk-v5';
import { useCommonStore } from '@/stores';
const commonStore = useCommonStore();

const cos = new COS({
  getAuthorization: async (options, callback) => {
    console.log('options', options);
    const {ExpiredTime,StartTime,TmpSecretId,TmpSecretKey,XCosSecurityToken} = commonStore.videoOptions;
    callback({
      ...options,
      ExpiredTime,
      StartTime,
      TmpSecretId,
      TmpSecretKey,
      XCosSecurityToken
      // 如果是永久密钥，不需要填入 ExpiredTime 参数
      // 临时密钥会带有过期时间（ExpiredTime），格式为millisecond
    })
    
  }
})

export default cos;